/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package da5221_lab1_2011;
/**
 *
 * @author ha
 */
public class SortingOperation {
    private int[] resultArr;
    public SortingOperation(){
        
    }
    private int n;
    private boolean swapped;
    public void sortArr(int []arr){
        n=arr.length;
        do{
            n=n-1;
            swapped=false;
            for(int i=0;i<n;i++){
                if(arr[i]>arr[i+1]){
                    int u=arr[i];
                    arr[i]=arr[i+1];
                    arr[i+1]=u;
                    swapped=true;
                }
            }
        }while(swapped);
        this.resultArr=arr;
    }
   
    public int[] getArr(){
        return resultArr;
    }
    public int search(int arr[]){
        int min=arr[0];
        for(int i=0;i<arr.length-1;i++){
            if(arr[i]>arr[i+1]){
                min=arr[i+1];
            }
        }
        return min;
        
    }

   
    
}
